<template>
	<view class="clinic">
		<view class="inputs">
			<text class="xing">门店名称</text><input type="text" v-model="clinicName" placeholder="请输入门店名称"/>
		</view>
		<view class="inputs">
			<text class="xing">联系电话</text><input type="text" v-model="phone"  placeholder="请输入联系电话"/>
		</view>
		<view class="inputs">
			<text class="xing">省</text><input type="text" v-model="Province"  placeholder="请输入门店地址"/>
		</view>
		<view class="inputs">
			<text class="xing">市</text><input type="text" v-model="City"  placeholder="请输入门店地址"/>
		</view>
		<view class="inputs">
			<text class="xing">区/县</text><input type="text" v-model="Area"  placeholder="请输入门店地址"/>
		</view>
		<view class="inputs">
			<text>乡</text><input type="text" v-model="Country"  placeholder="请输入门店地址"/>
		</view>
		<view class="sumbit" @click="sumbitData">
			提  交
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				userId:this.common.getStore('UserId'),
				clinicName:'',
				phone:'',
				Province:'',
				City:'',
				Area:'',
				Country:''
			}
		},
		methods:{
			sumbitData(){
				if(!this.clinicName){
					this.common.toast('none','请输入门店名称');
				}else if(!this.phone){
					this.common.toast('none','请输入联系电话');
				}else if(!this.Province){
					this.common.toast('none','请输入门店所在省会名');
				}else if(!this.City){
					this.common.toast('none','请输入门店所在城市名');
				}else if(!this.Area){
					this.common.toast('none','请输入门店所在区/县');
				}else{
					
					let data = {
						Address: "",
						ShopName: this.clinicName,
						Phone: this.phone,
						UserId: this.userId,
						Province:this.Province,
						City:this.City,
						Area:this.Area,
						Country:this.Country
					}
					
					this.$api.ShopApi(data).then(res=>{
						if(res.StatusCode == 200){
							this.common.toast('none','创建成功！');
							uni.navigateTo({
								url:'/pages/index/index'
							})
						}else{
							this.common.toast('none','创建失败,请重新创建！')
						}	
					})
				}
				
			}
		}
	}
</script>

<style>
	.clinic{
		padding-top: 100rpx;
	}
	.inputs{
		display: flex;
		align-items: center;
		padding: 0 20rpx;
		margin: 30rpx;
	}
	.inputs text{
		display: block;
		width: 44%;
		text-align: center;
		color: #555;
		font-size: 34rpx;
	}
	input{
		height: 60rpx;
		line-height: 60rpx;
		border: 1rpx solid #bbb;
		width: 100%;
		border-radius: 10rpx ;
		padding-left: 20rpx;
	}
	
	.sumbit{
		background: #0196FD;
		color: #fff;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		border-radius: 10rpx;
		width: 40%;
		margin: 0 auto;
		margin-top: 100rpx;
	}
</style>
